package com.tanhua.dubbo.api.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.domain.db.Options;
import com.tanhua.dubbo.api.OptionsApi;
import com.tanhua.dubbo.mapper.OptionsMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class OptionImpl implements OptionsApi {
    @Autowired
    private OptionsMapper optionsMapper;

    @Override
    public List<Options> findOptions(Integer id) {
        QueryWrapper<Options> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("question_Id", id);
        return optionsMapper.selectList(queryWrapper);
    }

    @Override
    public int Count(String optionId) {
        Options options = optionsMapper.selectById(optionId);
        return options.getScore();
    }
}
